// 提供合并多个reducer,并且reducer中的数据是immutable对象
import { combineReducers } from 'redux-immutable'

import { createStore, applyMiddleware, compose } from 'redux'
// 异步请求中间件
import thunk from 'redux-thunk'

// 导入reducer
import cookbook from './reducers/cookbook'
import search from './reducers/search'

// 合并，把多个reducer合并成一个reducer
const reducer = combineReducers({
  cookbook,
  search
})

// 配置chrome中的redux扩展可视化操作
const composeEnhancers =
  typeof window === 'object' &&
    window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ?
    window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}) : compose
const enhancer = composeEnhancers(
  // 中间件
  applyMiddleware(thunk)
)

// 创建数据仓库
export default createStore(
  reducer,
  enhancer
)




